﻿using System.Xml;
using Blackbird.Common.Properties;
using Blackbird.Core.Editable.Base;

namespace Blackbird.Core.Editable.Sprites
{
    public class EditableSpritePack : EditableEntityCollection<EditableMultisprite>
    {
        protected override void ReadXmlContent(XmlReader reader)
        {
            reader.ReadStartElement("sprites");
            reader.MoveToContent();
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                var sprite = new EditableMultisprite();
                sprite.ReadXml(reader);
                Add(sprite);
                reader.Read();
            }
        }

        protected override void WriteXmlContent(XmlWriter writer)
        {
            writer.WriteStartElement("sprites");
            foreach (EditableMultisprite sprite in this)
                sprite.WriteXml(writer);
            writer.WriteEndElement();
        }

        public override string TypeName
        {
            get { return Resources.EditableSpritePackTypeFriendlyName; }
        }

        protected override void ReadXmlAttributes(XmlReader reader)
        {
        }

        protected override void WriteXmlAttributes(XmlWriter writer)
        {
        }
    }
}